#include "SypEngine.h"

#ifdef CHECKMEM
#include "mmgr.h"
#endif

namespace Syp
{
	Label* Label::createLabel(const String& name,const String& text,Font* f)
	{
		return (new Label(name,text,f));
	}
	Label::Label(const String& name,const String& text,Font* f):GuiBase(name,0,0,false)
	{
		mi = MeshInstance::createMeshInstance();
		if(f)
		{
			this->setTextFont(f);
		}
		else
		{
			this->setTextFont(&SypEngine::getSypEngine().getSysFontRef());
		}

		this->setText(text);


	}

	void Label::setText(const String& txt)
	{
		title = txt;		
		fo->generateStaticMesh(txt, 0,0,0,mi);
	}

	void Label::setTextFont(Font* f)
	{
		fo = f;
	}


}
